<template>
    
  <div id="app">
    <el-config-provider :locale="elLocale">
      <router-view />
    </el-config-provider>
  </div>
</template>

<script>
import zhCn from '@toms/element-ui/es/locale/lang/zh-cn'
import en from '@toms/element-ui/es/locale/lang/en'
import ja from '@toms/element-ui/es/locale/lang/ja'
import pt from '@toms/element-ui/es/locale/lang/pt-br'
import { defineComponent, computed } from 'vue'
import { ElConfigProvider } from '@toms/element-ui'
import { useI18n } from 'vue-i18n'

export default  defineComponent({
    components: {
      ElConfigProvider,
    },
    setup() {      
      const { locale } = useI18n()
      const mapLocale = {
        'zh-CN': zhCn,
        'en-US': en,
        'pt-BR': pt,
        'ja-JP': ja
      }
      const elLocale = computed(() => {
        return mapLocale[locale.value]
      })
      return {        
        elLocale 
      }
    },
})
</script>
